home *** CD-ROM | disk | FTP | other *** search
/ The Lifestyles of the Rich & Famous Cookbook / The Lifestyles of the Rich & Famous Cookbook.iso / setup.inf < prev   
Text File  |  1993-08-13  |  46KB  |  1,193 lines

  1.     ;;*************Begin Title Specific Section***************************
  2.  
  3.     ;;
  4.     ;; SetVariable (Variable, String)
  5.     ;; ------------------------------
  6.     ;; This command sets the variable named 'Variable' to the string
  7.     ;; 'String'.
  8.     ;;
  9.  
  10.     ;;     Change this variable to be the name of the title.
  11.     ;;
  12. SetVariable (TitleName, "Rich and Famous Cookbook")    ; Name of the title
  13.  
  14.     ;;    Change this variable to be the basename of the title's MVB
  15.     ;;    file (i.e. the name of the MVB file without the .MVB 
  16.     ;;    extension).
  17.     ;;
  18. SetVariable (TitleMVB, "rich")        ; Basename of the MVB file
  19.  
  20.     ;;    Change this variable to be the subdirectory of the title
  21.     ;;    on the CD-ROM (i.e. where the MVB file is located).  This 
  22.     ;;    subdirectory will be in the Viewer directory on the CD-ROM,
  23.     ;;    where VIEWER.EXE and SETUP.EXE are located.  Do not specify
  24.     ;;    the complete path for this subdirectory.
  25.     ;;
  26. SetVariable (TitleSrcDir, "\rich\")    ; Source subdirectory of the title
  27.  
  28.     ;;***************End Title Specific Section***************************
  29.  
  30.     ;;
  31.     ;; GetCurPath (Variable)
  32.     ;; ---------------------
  33.     ;; This command sets the variable 'Variable' to the current path.
  34.     ;; This is the full path of the directory in which SETUP.EXE was 
  35.     ;; started.  A directory name ends in a backslash.
  36.     ;;
  37.  
  38. GetCurPath (ViewerSrcDir)        ; Source directory of the Viewer
  39. SetVariable (ViewerSize, 850 030)    ; Size of the Viewer files that will
  40.                     ;  be copied over (measured in bytes)
  41. SetVariable (ViewerDestDir, "C:\MVIEWER\")    ; Destination directory for 
  42.                         ;  the Viewer.  Set default
  43.                         ;  here.
  44.  
  45.     ;;
  46.     ;; WindowTitle (Title)
  47.     ;; -------------------
  48.     ;; This command sets the title bar of all subsequent dialog windows to
  49.     ;; the string 'Title'.  The title string must be limited to 127 
  50.     ;; characters.  The title bar can be changed before the first dialog
  51.     ;; window is shown or at any later time using this command.  By 
  52.     ;; default, the title for all dialog windows is "Setup".
  53.     ;;
  54.  
  55. ; Set the title of all dialog windows.
  56. ;
  57. WindowTitle (<TitleName> " Setup")
  58.  
  59.  
  60. ; Set the instruction text used in the initial instructions window.
  61. ; Add Help instructions if the file SETUP.HLP exists.
  62. ;
  63. SetVariable (InitialInstructions, 
  64.     "Click on {\b OK} or press {\b Enter} to continue.  "
  65.     "To abort the setup, click on the {\b Exit} button at the "
  66.     "bottom right corner of the screen, or press {\b F3}.  ")
  67.  
  68.     ;;
  69.     ;; IfFileExistsGoto (FileName, Label)
  70.     ;; ----------------------------------
  71.     ;; This command causes execution to jump to label 'Label' if the
  72.     ;; specified file exists.  This command can be used while the copy
  73.     ;; progress bar is up, but if you do so then you should not check if a
  74.     ;; file exists if that file has been created between the 
  75.     ;; 'OpenCopyProgress' and the 'IfFileExistsGoto'.  The reason for this
  76.     ;; is that 'OpenCopyProgress' will first step through all the copy and
  77.     ;; branching commands until the 'CloseCopyProgress' command without
  78.     ;; actually copying any files.  This is done in order to find the
  79.     ;; range for the copy progress bar.  The 'IfFileExistsGoto' command
  80.     ;; is typically used to see if you are reinstalling files.
  81.     ;;
  82.  
  83. IfFileExistsGoto ("SETUP.HLP", AddHelpInstructions)
  84.  
  85.     ;;
  86.     ;; Goto (Label)
  87.     ;; ------------
  88.     ;; This command will unconditionally cause execution to branch to the
  89.     ;; label 'Label'.
  90.     ;;
  91.  
  92.     Goto (DisplayInitialMessage)
  93. AddHelpInstructions:
  94.     SetVariable (InitialInstructions, 
  95.         <InitialInstructions> "You can always obtain help by "
  96.         "clicking on the {\b Help} button or pressing {\b F1}.  ")
  97.  
  98.     ;;
  99.     ;; DisplayMessage (Text, Instructions)
  100.     ;; -----------------------------------
  101.     ;; This command displays the message 'Text' in a dialog box and the
  102.     ;; instruction text 'Instructions' in the instructions window.  
  103.     ;; A single "OK" default push button at the bottom center of the 
  104.     ;; dialog is used to resume.
  105.     ;;
  106.  
  107. ; Display the initial message.
  108. ;
  109. DisplayInitialMessage:
  110. DisplayMessage (
  111.     "
  112.     This Setup program will install:
  113.     
  114.         " <TitleName> "
  115.     
  116.         and the Multimedia Viewer.
  117.         
  118.          ",
  119.          <InitialInstructions>)
  120.  
  121.     ;;
  122.     ;; GetFromWinIni (Variable, Section, Name, Default)
  123.     ;; ------------------------------------------------
  124.     ;; This command reads the WIN.INI file entry 'Name' under the section
  125.     ;; 'Section' and sets the variable 'Variable' to the result.  If the
  126.     ;; specified section or entry were not found, then the specified 
  127.     ;; variable is set to the string 'Default'.
  128.     ;;
  129.  
  130. ; Determine if the Viewer has been installed before.
  131. ; If the WIN.INI file contains information on where the Viewer directory
  132. ; is located, then make that the default path to install the Viewer.
  133. ;
  134. GetFromWinIni (ViewerDestDirTemp, 
  135.     "Multimedia Viewer", "ViewerPath", "Undefined")
  136.  
  137.     ;;
  138.     ;; IfEqualGoto (String1, String2, Label)
  139.     ;; -------------------------------------
  140.     ;; This command will do a case insensitive compare on the strings
  141.     ;; 'String1' and 'String2' and branch to label 'Label' if they match.
  142.     ;;
  143.  
  144. IfEqualGoto (<ViewerDestDirTemp>, "Undefined", PromptViewerDestDir)
  145. SetVariable (ViewerDestDir, <ViewerDestDirTemp>)
  146.  
  147.  
  148. AskAgain:
  149.  
  150.     ;;
  151.     ;; PromptPath (Variable, Default, Message, ValidInstructions,
  152.     ;;        InvalidInstructions)
  153.     ;; ----------------------------------------------------------
  154.     ;; This command causes a dialog box to appear that prompts the user 
  155.     ;; for a path.  The path is a directory that the setup script can use
  156.     ;; to copy into, make, etc.  The message 'Message' is shown at the top
  157.     ;; of the dialog, and the default path is 'Default'.   When PromptPath
  158.     ;; is invoked, Setup checks that the default specified in the INF file
  159.     ;; is a valid path on the user's machine. 
  160.     ;;
  161.     ;; The PromptPath dialog can be in two states.  Whenever the edit box
  162.     ;; contains a valid path, the OK button is available and the 
  163.     ;; 'ValidInstructions' text is displayed in the instruction window.
  164.     ;; Whenever the edit box contains an invalid path, the OK button is
  165.     ;; grayed out and the 'InvalidInstructions' text is displayed in the
  166.     ;; instruction window.
  167.     ;;
  168.     ;; All characters typed in the path edit box appear as upper case no
  169.     ;; matter what the keyboard shift state is in.  When the OK button is
  170.     ;; enabled, the user can click on the OK button or press Enter, upon
  171.     ;; which the path is placed in the variable 'Variable'.  Before
  172.     ;; returning the path however, PromptPath will translate all forward
  173.     ;; slashes to back slashes and ensure that the path ends in a
  174.     ;; back slash.
  175.     ;;
  176.  
  177. ViewerPathOK:
  178.        
  179. ; Ask for where the Multimedia Viewer should be installed.
  180. ;
  181. PromptViewerDestDir:
  182. PromptPath (<ViewerDestDir>, <ViewerDestDir>,
  183.  
  184.  
  185.     "Where should Setup install the Multimedia Viewer?",
  186.     "Modify the default path if necessary, and then click on {\b OK} or "
  187.     "press {\b Enter} to continue.  ",
  188.     "The path is currently not valid.  You must specify a drive "
  189.     "letter, a colon, and a directory from the root of the drive.  ")
  190.  
  191.     ;;
  192.     ;; GetWinPath (Variable)
  193.     ;; ---------------------
  194.     ;; This command sets the variable 'Variable' to the path of the
  195.     ;; Windows directory.  The directory name ends in a backslash.
  196.     ;;
  197.     ;;
  198.  
  199. ; Don't allow Viewer to be installed in the Windows directory
  200. ;
  201. GetWinSystemPath (SystemPath)
  202. GetWinPath (WinPath)
  203. IfNotEqualGoto (<ViewerDestDir>, <WinPath>, CheckSpace)
  204. DisplayMessage (
  205.     "You cannot install the Viewer into the Windows directory.  "
  206.     "Please enter another directory.",
  207.     "Click on {\b OK} or press {\b Enter} to enter another directory "
  208.     "for Viewer.")
  209. Goto (PromptViewerDestDir)
  210.  
  211.     ;;
  212.     ;; GetSpaceAvailable (Variable, Path)
  213.     ;; ----------------------------------
  214.     ;; This command finds the number of bytes available on the disk of 
  215.     ;; the full path 'Path', and sets the variable 'Variable' to the 
  216.     ;; string representation of this value.  The value 0 is returned if
  217.     ;; the specified volume does not exist or cannot be read.
  218.     ;;
  219.  
  220. ; Check if there is enough space to install the Viewer.
  221. ;
  222. CheckSpace:
  223. GetSpaceAvailable (SpaceAvailable, <ViewerDestDir>)
  224.  
  225.     ;;
  226.     ;; IfLowerGoto (Number1, Number2, Label)
  227.     ;; -------------------------------------
  228.     ;; This command will compare 'Number1' and 'Number2', which are 
  229.     ;; strings interpreted as integers.  If 'Number1' is lower than 
  230.     ;; 'Number2' then execution branches to 'Label'.
  231.     ;;
  232.  
  233. IfLowerGoto (<ViewerSize>, <SpaceAvailable>, ViewerDestDirOK)
  234.  
  235.     ;;
  236.     ;; AskYesNo (Variable, Default, Question, Instructions)
  237.     ;; ----------------------------------------------------
  238.     ;; This command displays the string 'Question' in a dialog box and the
  239.     ;; instruction text 'Instructions' in the instruction window.  The
  240.     ;; dialog box has two buttons, labeled "Yes" and "No".  The string
  241.     ;; 'Default' should be either "Yes" or "No" to specify which button is
  242.     ;; the default button.  After a button is pushed, the variable
  243.     ;; 'Variable' is set to the string "Yes" or the string "No" as
  244.     ;; appropriate.
  245.     ;;
  246.  
  247. AskYesNo (Prompt, "Yes",
  248.     "There may not be enough space to install the Multimedia Viewer.  "
  249.     "Would you like to enter a new path for the files?  ",
  250.     "Click on {\b Yes} or press {\b 'Y'} to enter a new path for the "
  251.     "Multimedia Viewer files.\par "
  252.     "Click on {\b No} or press {\b 'N'} to continue anyway.\par "
  253.     "Click on the {\b Exit} button or press {\b F3} to exit Setup.  "
  254.     "You may wish to exit Setup and make some more space on your hard "
  255.     "disk.  Run Setup again when there is enough space on your hard "
  256.     "disk.  ")
  257. IfEqualGoto (<Prompt>, "Yes", PromptViewerDestDir)
  258.  
  259.  
  260. ViewerDestDirOK:
  261. AskYesNo (AskAgain, "No", 
  262.     "Would you like to change anything before proceeding with "
  263.     "the installation?",
  264.     "Click on {\b Yes} or press {\b 'Y'} to reenter options.\par "
  265.     "Click on {\b No} or press {\b 'N'} to proceed with installation.  ")
  266. IfEqualGoto (<AskAgain>, "Yes", AskAgain)
  267.  
  268.     ;;
  269.     ;; MakePath (Path)
  270.     ;; ---------------
  271.     ;; This command causes the path 'Path' to be created if it does not
  272.     ;; already exist.  To make the path, MakePath creates any
  273.     ;; subdirectories that do not already exist.  If the path cannot be
  274.     ;; created, then no error will be reported, as the problem will
  275.     ;; normally be detected when Setup attempts to copy files to this
  276.     ;; path.
  277.     ;;
  278.  
  279. ; Create the tree structure.
  280. ;
  281. MakePath (<ViewerDestDir>)
  282.  
  283.  
  284.     ;;
  285.     ;; OpenCopyProgress (Message, Instructions)
  286.     ;; ----------------------------------------
  287.     ;; This command begins a file manipulation section.  The command will
  288.     ;; open a progress bar dialog with the message 'Message' and the
  289.     ;; instruction text 'Instructions'.  Following this command, only the
  290.     ;; commands 'SetProgressBarMsg', 'PromptChangeDisk', 'CopyFile',
  291.     ;; 'AppendFile', 'UpdateFile', 'TranslateFile', 'DeleteFile', 
  292.     ;; 'RenameFile', 'Goto', 'IfEqualGoto', 'IfNotEqualGoto', 'ErrorExit',
  293.     ;; 'IfLowerGoto', 'IfHigherGoto', 'IfFileExistsGoto', 'Pause', and
  294.     ;; 'MakePath' are allowed until the 'CloseCopyProgress' command is
  295.     ;; reached.  An error is reported and Setup is aborted if any other
  296.     ;; commands are encountered while the progress bar is displayed.
  297.     ;;
  298.  
  299. ; Copy the files
  300. ;
  301. OpenCopyProgress (
  302.     "Setup is copying the Multimedia Viewer runtime files.",
  303.     "Please wait while Setup is copying files.")
  304.  
  305.     ;;
  306.     ;; CopyFile (Source, Destination, Size)
  307.     ;; ------------------------------------
  308.     ;; This command copies the file 'Source' to the file 'Destination'.
  309.     ;; The current disk and directory will be that of the Setup 
  310.     ;; executable.  Normally the files to copy will be in the same place
  311.     ;; (although a volume change may be required---see PromptChangeDisk)
  312.     ;; so a relative path is normally used for the source file name.
  313.     ;; Normally variables are used to specify a complete destination file
  314.     ;; name that depends on the user's path selection.  Any directories 
  315.     ;; specified in the destination path must already exist---they are
  316.     ;; normally created using the MakePath commands. 
  317.     ;;
  318.     ;; The 'Size' field specifies the size of the source file.  In order
  319.     ;; to initialize the progress bar it is necessary to find the total
  320.     ;; number of bytes to copy between the OpenCopyProgress command and
  321.     ;; the CloseCopyProgress command.  Since files may span several disks,
  322.     ;; it would be impractical to obtain this size directly from the 
  323.     ;; source file.  The size field is only required to maintain the
  324.     ;; progress bar, and, although it need not be exact, it should be
  325.     ;; close to reality to maintain the accuracy of the progress bar.
  326.     ;;
  327.     ;; If an error occurs (such as File Not Found, Read Error, Write 
  328.     ;; Error) then an error dialog is shown, at which point the user has
  329.     ;; the option to Abort Setup, Retry the copy operation, or Ignore the
  330.     ;; copy error.  Selecting Abort has the same effect as pressing <F3>. 
  331.     ;; Selecting Retry causes the operation to be retried.  Finally,
  332.     ;; selecting Ignore causes copying to continue despite the error.  The
  333.     ;; latter option will likely result in an incomplete Setup.  The
  334.     ;; command 'IfIncompleteGoto' can be used subsequently to give the 
  335.     ;; user an appropriate message.
  336.     ;;
  337.     ;; Files compressed using the Windows SDK COMPRESS utility will 
  338.     ;; automatically be decompressed as they are being copied to the hard
  339.     ;; disk. 
  340.     ;;
  341.  
  342. CopyFile ("CTL3D.DLL",    <ViewerDestDir> "CTL3D.DLL",     14000)
  343. CopyFile ("MVAPI2.DLL",   <ViewerDestDir> "MVAPI2.DLL",    12000)
  344. CopyFile ("MVBMP2.DLL",   <ViewerDestDir> "MVBMP2.DLL",   138000)
  345. CopyFile ("MVBRKR2.DLL",  <ViewerDestDir> "MVBRKR2.DLL",   19000)
  346. CopyFile ("MVFS2.DLL",    <ViewerDestDir> "MVFS2.DLL",     52000)
  347. CopyFile ("MVFTSUI2.DLL", <ViewerDestDir> "MVFTSUI2.DLL", 155000)
  348. CopyFile ("MVIEWER2.EXE", <ViewerDestDir> "MVIEWER2.EXE", 286000)
  349. CopyFile ("MVMCI2.DLL",   <ViewerDestDir> "MVMCI2.DLL",    91000)
  350. CopyFile ("MVSRCH2.DLL",  <ViewerDestDir> "MVSRCH2.DLL",   53000)
  351. CopyFile ("MVTITLE2.DLL", <ViewerDestDir> "MVTITLE2.DLL",  24000)
  352. CopyFile ("COMPTONS.ICO", <ViewerDestDir> "COMPTONS.ICO",  25000)
  353.  
  354.            ;;
  355.     ;; CloseCopyProgress ()
  356.     ;; --------------------
  357.     ;; This command closes the copy progress bar.
  358.     ;;
  359.  
  360. CloseCopyProgress ()
  361.  
  362.     ;;*************Begin Title Specific Section***************************
  363.  
  364. ;;
  365.     ;; OpenProgmanProgress (Message, Instructions)
  366.     ;; -------------------------------------------
  367.     ;; This command begins a Program Manager installation section.
  368.     ;; This command will put up a progress bar with the message 'Message'
  369.     ;; and the instructions 'Instructions'.  Following this command, only
  370.     ;; the commands 'SetProgressBarMsg', 'OpenProgmanGroup', 'ErrorExit',
  371.     ;; 'AddProgmanItem', 'Goto', 'IfEqualGoto', 'IfNotEqualGoto',
  372.     ;; 'IfLowerGoto', 'IfHigherGoto', 'IfFileExistsGoto', and 'Pause' are
  373.     ;; allowed until the 'CloseProgmanProgress' command is reached.  An
  374.     ;; error is reported and Setup is aborted if any other commands are
  375.     ;; encountered while the progress bar is displayed.
  376.     ;;
  377.  
  378. ; Begin adding Progam Manager groups
  379. ;
  380. OpenProgmanProgress (
  381.     "Setup is adding Program Manager groups.",
  382.     "Please wait while Setup adds {\b Program Manager} groups".)
  383.  
  384.     ;;
  385.     ;; OpenProgmanGroup (Group[,  DeleteFlag])
  386.     ;; ---------------------------------------
  387.     ;; This command will set up a DDE conversation with the Program 
  388.     ;; Manager and open the program group entitled 'Group'.  If the 
  389.     ;; optional string 'Delete' is specified and is equal to "Delete", 
  390.     ;; then the specified group will be deleted if it exists, before it is
  391.     ;; created.  Normally this Delete flag is specified to create a new 
  392.     ;; program group, and is omitted to add to an existing group. 
  393.     ;; 
  394.     ;; The progress bar will display the words "Opening" followed by the
  395.     ;; name of the ProgMan group.  If OpenProgmanGroup fails then no error
  396.     ;; is reported.
  397.     ;;
  398.  
  399. ; Add a specific Program Manager group.
  400. ;
  401.  
  402. OpenProgmanGroup ("Compton's NewMedia", Delete)    ;; Add the group named after the title
  403. AddProgManItem(<TitleName>,<ViewerDestDir> "MVIEWER2.EXE "<ViewerSrcDir>"RICH\"<TitleMVB> ".MVB",
  404.   <ViewerDestDir>"COMPTONS.ICO" ,0)
  405.  
  406. CloseProgmanProgress ()
  407.  
  408.  
  409.     ;;
  410.     ;; AddToProfileIni (File, Tag, Name, Value)
  411.     ;; ----------------------------------------
  412.     ;; This command is identical to AddToWinIni, except that any profile
  413.     ;; file can be used.  This can be used to access the SYSTEM.INI file
  414.     ;; and any other private profile files.  No error is reported if this
  415.     ;; operation fails.
  416.     ;;
  417.  
  418. ; Update VIEWER.INI.
  419. ;
  420. AddToProfileIni ("VIEWER.INI", <TitleMVB>, "Path", 
  421.     <ViewerSrcDir> <TitleSrcDir>)
  422. AddToProfileIni ("VIEWER.INI", "Files", <TitleMVB> ".MVB", 
  423.     <ViewerSrcDir> <TitleSrcDir>
  424.     ",Please insert the " <TitleName> " CD in the CD-ROM drive")
  425.  
  426.     ;;    For each of the other books in a multiple-book title, add
  427.     ;;    a VIEWER.INI section that is named after the basename of
  428.     ;;    that book's MVB file (which should be in the same directory
  429.     ;;    as the main title's MVB file).
  430.     ;;
  431. AddToProfileIni ("VIEWER.INI", 
  432.     "rich",        ; Basename of the MVB file
  433.     "Path", <ViewerSrcDir> <TitleSrcDir>)
  434.  
  435.     ;;***************End Title Specific Section***************************
  436.  
  437.     ;;
  438.     ;; AddToWinIni (Tag, Name, Value)
  439.     ;; ------------------------------
  440.     ;; This command adds or modifies the WIN.INI file entry 'Name' under
  441.     ;; the tag 'Tag' to equal the string 'Value'.  No error is reported if
  442.     ;; this operation fails.
  443.     ;;
  444.  
  445. ; Update WIN.INI.
  446. ;
  447. AddToWinIni ("Multimedia Viewer", "ViewerPath", <ViewerDestDir>)
  448. AddToWinIni ("Extensions", "mvb", "mviewer2.exe ^.mvb")
  449.  
  450. Goto (End)
  451.  
  452.     ;;
  453.     ;; ModifyAutoexec (Path, Lib, Include, AskInstructions, 
  454.     ;;        ReviewInstructions, SaveInstructions)
  455.     ;; ----------------------------------------------------
  456.     ;; This command ensures that the following environment variables in
  457.     ;; the AUTOEXEC.BAT file are set:
  458.     ;;
  459.     ;;    1. the path 'Path' is present in the PATH variable
  460.     ;;    2. the path 'Lib' is present in the LIB variable
  461.     ;;    3. the path 'Include' is present in the INCLUDE variable
  462.     ;; 
  463.     ;; If any of  'Path', 'Lib', or 'Include' is the null string (""),
  464.     ;; then the corresponding environment variable is ignored.
  465.     ;;
  466.     ;; If an environment variable needs to be changed, a dialog window
  467.     ;; is brought up.  If all the required paths are already in the
  468.     ;; current environment variables, then no dialog is shown.  The
  469.     ;; instruction window contains the instruction text 'AskInstructions'.
  470.     ;;
  471.     ;; If the default option to make the modifications is selected, then
  472.     ;; the old AUTOEXEC.BAT file is saved to AUTOEXEC.BAK and the required
  473.     ;; changes are made to the current AUTOEXEC.BAT file.  Paths are added
  474.     ;; to the beginning of the path list in the PATH, SET LIB, and
  475.     ;; SET INCLUDE statements.   If the statement to set the appropriate
  476.     ;; environment variable is not present then the statement is added to
  477.     ;; the end of the AUTOEXEC.BAT file.  If the AUTOEXEC.BAT file is not
  478.     ;; found, then a new AUTOEXEC.BAT file is created to contain these
  479.     ;; new statements.
  480.     ;;
  481.     ;; If the option to review and edit the changes is chosen then the
  482.     ;; following dialog is shown:
  483.     ;;
  484.     ;; The upper edit box shows the proposed changes to the AUTOEXEC.BAT
  485.     ;; file and the lower edit box shows the current AUTOEXEC.BAT file
  486.     ;; contents.  The instruction window shows the instructon text
  487.     ;; 'ReviewInstructions'.   Any changes made to the upper edit box are
  488.     ;; saved when the user clicks on the OK default button or presses
  489.     ;; <Enter> to save the changes.  The old AUTOEXEC.BAT is saved to the
  490.     ;; file AUTOEXEC.BAK before the changes are made.  The Cancel button
  491.     ;; brings back the previous dialog.
  492.     ;;
  493.     ;; If the option to make the modifications later is chosen then the
  494.     ;; following dialog is shown:
  495.     ;;
  496.     ;; Here the user can specify a file that will contain the
  497.     ;; modifications made to the AUTOEXEC.BAT file.  The instruction
  498.     ;; window shows the instruction text 'SaveInstructions'.  The default
  499.     ;; filename is AUTOEXEC.NEW, but the user can changes this by editing
  500.     ;; the file in the dialog box.  To save the changes to the specified
  501.     ;; file, the user clicks on the Save button or presses 'S' or Enter.
  502.     ;; To not save the changes, the user clicks on the Don't Save button.
  503.     ;; To return to the previous dialog, the user clicks on the Cancel
  504.     ;; button or presses Esc.
  505.     ;;
  506.  
  507. ; Add the Viewer path to the PATH variable in the environment.
  508. ;
  509. ModifyAutoexec (<ViewerDestDir>, "", "",
  510.     "Setup must now make some changes to your {\b AUTOEXEC.BAT} file.  "
  511.     "Click on the desired option and click on {\b OK} to continue.  With "
  512.     "the keyboard, use the arrow keys to select the desired option, and "
  513.     "then press {\b Enter} to continue.\par\par "
  514.     "{\b o} Select the first option to let Setup modify your "
  515.     "AUTOEXEC.BAT file\par "
  516.     "{\b o} Select the second option to view and change the changes "
  517.     "first\par "
  518.     "{\b o} Select the third option if you want to make the changes "
  519.     "yourself later on\par\par ",
  520.     "You can now view the proposed changes to the {\b AUTOEXEC.BAT} "
  521.     "file.  If the changes were not made to your satisfaction, you can "
  522.     "modify the proposed batch file by editing the file in the top "
  523.     "window.  Click on {\b OK} or press {\b Enter} to replace the "
  524.     "current batch file with the proposed one.  To return to the "
  525.     "AUTOEXEC modification options dialog, click on {\b Cancel} or press "
  526.     "{\b Esc}.", 
  527.     "Setup can save the proposed {\b AUTOEXEC.BAT} file to a file that "
  528.     "you specify.  You will have to modify your own {\b AUTOEXEC.BAT} "
  529.     "file yourself and then reboot your computer in order for the Viewer "
  530.     "to function normally.  To return to the AUTOEXEC modification "
  531.     "options dialog, click on {\b Cancel} or press {\b Esc}.")
  532.  
  533. ; Assemble and display finished message
  534.  
  535.     ;;
  536.     ;; IfIncompleteGoto (Label)
  537.     ;; ------------------------
  538.     ;; This command will branch to the label 'Label' if the installation
  539.     ;; was incomplete.  The installation is incomplete if there was an
  540.     ;; error for any file that was copied to the hard disk and the user
  541.     ;; specified to ignore the error.  The installation is also incomplete
  542.     ;; if the 'SetIncomplete' command was executed.
  543.     ;;
  544.  
  545. IfIncompleteGoto (Incomplete)
  546.     SetVariable (Message, 
  547.         "%nThe Setup program has successfully installed%n"
  548.         "the Multimedia Viewer and "<TitleName> ".%n%n")
  549.     Goto (CheckAutoexec)
  550. Incomplete:
  551.     SetVariable (Message,
  552.         "Setup has finished, but the installation was incomplete.  "
  553.         "You should correct any problems (such as insufficient disk "
  554.         "space, missing source files, or locked directories) and run "
  555.         "Setup again.%n%n")
  556.  
  557.  
  558. CheckAutoexec:
  559.  
  560.     ;;
  561.     ;; IfMustModifyGoto (Label)
  562.     ;; ------------------------
  563.     ;; This command will branch to the label 'Label' if Setup had to 
  564.     ;; modify the AUTOEXEC.BAT file, but the user chose to do the
  565.     ;; modifications themselves later.  The command will also branch
  566.     ;; if the 'SetMustModify' command was executed.
  567.     ;;
  568.  
  569. IfMustModifyGoto (MustModify)
  570.  
  571.     ;;
  572.     ;; IfMustRebootGoto (Label)
  573.     ;; ------------------------
  574.     ;; This command will branch to the label 'Label' if Setup has
  575.     ;; modified the AUTOEXEC.BAT file, and the user
  576.     ;; must now reboot the computer.  The command will also branch
  577.     ;; if the 'SetMustReboot' command was executed.
  578.     ;;
  579.  
  580. IfMustRebootGoto (MustReboot)
  581. Goto (End)
  582.  
  583.  
  584. MustModify:
  585.  
  586. SetVariable (Message, 
  587.     <Message> "Remember to modify your AUTOEXEC.BAT file and reboot your "
  588.     "computer before using the Multimedia Viewer.%n%n")
  589. Goto (End)
  590.  
  591.  
  592. MustReboot:
  593.  
  594. SetVariable (Message,
  595.     <Message> "For the changes made by Setup to come into "
  596.     "effect, you must reboot your computer.  To do this, you must first "
  597.     "exit Windows and then simultaneously hold down the Ctrl, Alt, and "
  598.     "Del keys.  You must do this before using the Multimedia Viewer.%n%n")
  599.  
  600.  
  601. End:
  602. SetVariable (Message, 
  603.         "%nThe Setup program has successfully installed%n"
  604.         "the Multimedia Viewer and "<TitleName> ".%n%n")
  605.  
  606. SetVariable (Message, 
  607.     <Message> "%nThe advantages of being a registered user are numerous.%n"
  608.     "Please send in your Product Registration Card TODAY.")
  609.  
  610. DisplayMessage (<Message>, 
  611.     "Click on {\b OK} or press {\b Enter} to return to the "
  612.     "Program Manager.")
  613.  
  614.  
  615.     ;;
  616.     ;; The following are other commands that Setup recognizes
  617.     ;;
  618.     ;;
  619.     ;; IfNotEqualGoto (String1, String2, Label)
  620.     ;; ----------------------------------------
  621.     ;; This command will do a case insensitive compare on the strings
  622.     ;; 'String1' and 'String2' and branch to 'Label' if they do not match.
  623.     ;;
  624.     ;; IfHigherGoto (Number1, Number2, Label)
  625.     ;; --------------------------------------
  626.     ;; This command will compare 'Number1' and 'Number2', which are
  627.     ;; strings interpreted as long integers.  If 'Number1' is higher 
  628.     ;; than 'Number2' then execution branches to 'Label'.
  629.     ;;
  630.     ;; Add (Variable, Number)
  631.     ;; --------------------------
  632.     ;; This command will add the value 'Number' to the old value of the
  633.     ;; variable 'Variable', and store the result as the new value of
  634.     ;; 'Variable'.  Both the old value of 'Variable' and the string
  635.     ;; 'Number' are interpreted as long integers.
  636.     ;;
  637.     ;; Subtract (Variable, Number)
  638.     ;; -------------------------------
  639.     ;; This command will subtract the value 'Number' from the old value
  640.     ;; of the variable 'Variable', and store the result as the new value
  641.     ;; of 'Variable'.  Both the old value of 'Variable' and the string
  642.     ;; 'Number' are interpreted as long integers.
  643.     ;;
  644.     ;; SetProgressBarMsg (Message)
  645.     ;; ---------------------------
  646.     ;; This command changes the progress bar message to 'Message'.
  647.     ;; This is used to let the user know which group of files is currently
  648.     ;; being copied.
  649.     ;;
  650.     ;; GetWinSystemPath (Variable)
  651.     ;; ---------------------------
  652.     ;; This command sets the variable 'Variable' to the path of the
  653.     ;; Windows System directory.  The directory name ends in a backslash.
  654.     ;;
  655.     ;; Confirm (Variable, Default, Text, Instructions)
  656.     ;; -----------------------------------------------
  657.     ;; This command behaves identically to the AskYesNo command, except
  658.     ;; that it is used to confirm that the options that have been entered
  659.     ;; are correct.  The string 'Text' is normally built from the answers
  660.     ;; to the other prompt commands.
  661.     ;;
  662.     ;; PromptChangeDisk (DiskLabel, File, Instructions)
  663.     ;; ------------------------------------------------
  664.     ;; This command pops up a dialog window requesting the user to insert
  665.     ;; the disk labeled 'DiskLabel' into the current drive.  When the user
  666.     ;; clicks on the "OK" button or presses Enter, Setup checks to see
  667.     ;; that the file with the given name exists.  If the file does not
  668.     ;; exist then Setup assumes that the wrong disk was inserted and the
  669.     ;; dialog remains active.  This is repeated until the file is found,
  670.     ;; at which time the dialog box is removed and execution continues.
  671.     ;;
  672.     ;; UpdateFile (Source, Destination, Size)
  673.     ;; --------------------------------------
  674.     ;; This command is identical to the CopyFile command, except that if
  675.     ;; the destination file exists then it will read the version number
  676.     ;; of the source and the destination files and perform the copy only
  677.     ;; if the version number of the source file is higher than that of the
  678.     ;; destination file.  The source file must not be compressed for this
  679.     ;; to work.
  680.     ;;
  681.     ;; AppendFile (Source, Destination, Size)
  682.     ;; --------------------------------------
  683.     ;; This command is identical to the CopyFile command, except that the
  684.     ;; source file is appended to the destination file.  This command is 
  685.     ;; useful for copying files that span several volumes.
  686.     ;;
  687.     ;; Files compressed using the Windows SDK COMPRESS utility will
  688.     ;; automatically be decompressed as they are being copied to the hard
  689.     ;; disk. 
  690.     ;;
  691.     ;; TranslateFile (Source, Destination, Size, Tag1, Replacement1, 
  692.     ;;         Tag2, Replacement2, ...)
  693.     ;; -------------------------------------------------------------
  694.     ;; The TranslateFile command behaves just like the CopyFile command,
  695.     ;; except that all strings enclosed in double angle brackets (<<...>>)
  696.     ;; in the source file are treated as "tags" which, together with the
  697.     ;; angle brackets, get replaced by the corresponding replacement
  698.     ;; strings in the destination file.
  699.     ;;
  700.     ;; For instance, if the source file "SOURCE.BAT" contains the line
  701.     ;;
  702.     ;;     set WinDir=<<WinDir>>
  703.     ;;
  704.     ;; and the following commands are used to copy the file
  705.     ;;
  706.     ;;    GetWinPath (WindowsDir)
  707.     ;;    .
  708.     ;;    .
  709.     ;;    TranslateFile ("SOURCE.BAT", "DEST.BAT", 1000, 
  710.     ;;        "WinDir", <WindowsDir>)
  711.     ;;
  712.     ;; then the file "DEST.BAT" will contain the following line:
  713.     ;;
  714.     ;;    set WinDir=C:\WIN
  715.     ;;
  716.     ;; The tag can be up to 127 characters long.  If the tag is not listed
  717.     ;; with its replacement string then the tag and its angle brackets
  718.     ;; will not be present in the destination file.
  719.     ;;
  720.     ;; The source file can be compressed.  This command is not 
  721.     ;; particularly fast, so it is only suited for short files, like INI
  722.     ;; files and BAT files.
  723.     ;;
  724.     ;; RenameFile (CurrentName, NewName)
  725.     ;; ---------------------------------
  726.     ;; This command renames the file specified by 'CurrentName' to
  727.     ;; 'NewName'.  No error is reported if this command fails.
  728.     ;;
  729.     ;; DeleteFile (FileName)
  730.     ;; ---------------------
  731.     ;; This command deletes the file specified by 'FileName', if this
  732.     ;; file exists.  No error is reported if this command fails.
  733.     ;;
  734.     ;; GetFromProfileIni (Variable, File, Tag, Name, Default)
  735.     ;; ------------------------------------------------------
  736.     ;; This command is identical to GetFromWinIni except that any profile
  737.     ;; file can be used.
  738.     ;;
  739.     ;; Pause (Time)
  740.     ;; ------------
  741.     ;; This command will pause execution in the script file for the
  742.     ;; specified number of milliseconds.  This command can be used when
  743.     ;; copying files or modifying the Program Manager groups in order to
  744.     ;; give the user time to see what is happening.
  745.     ;;
  746.     ;; Execute (CommandString, DisplayType)
  747.     ;; ------------------------------------
  748.     ;; This command will launch the program specified in the string
  749.     ;; 'CommandString'.  Parameters can appear following the program name.
  750.     ;; The argument 'DisplayType' determines whether the program window is
  751.     ;; shown as hidden, normal, minimized, or maximized, as specified in
  752.     ;; the following table:
  753.     ;;
  754.     ;;    'DisplayType'                Effect
  755.     ;;        0            Window appears hidden
  756.     ;;        1            Window appears normal
  757.     ;;        2            Window appears minimized
  758.     ;;        3            Window appears maximized
  759.     ;;
  760.     ;; ErrorExit (Text)
  761.     ;; ---------------------
  762.     ;; This command forces Setup to exit after a fatal error.  A message
  763.     ;; box pops up with the message 'Text' explaining the error, and then
  764.     ;; Setup ends.
  765.     ;;
  766.     ;; SendWinIniChange (Section)
  767.     ;; --------------------------
  768.     ;; This command broadcasts a WM_WININICHANGE message to all top-level
  769.     ;; windows when changes have been made to the section 'Section' in
  770.     ;; the Windows initialization file, WIN.INI.  The section name does
  771.     ;; not include the square brackets.
  772.     ;;
  773.     ;; SendDevModeChange (Device)
  774.     ;; --------------------------
  775.     ;; This command broadcasts a WM_DEVMODECHANGE message to all top-level
  776.     ;; windows when changes have been made to the device-mode settings
  777.     ;; of the device 'Device'.
  778.     ;;
  779.     ;; ParseField (Variable, String, FieldPosition)
  780.     ;; --------------------------------------------
  781.     ;; This command sets the variable 'Variable' to be the field specified
  782.     ;; by the number 'FieldPosition' in the string 'String'.  Fields are
  783.     ;; separated by commas.  The first field in a string is in position 1.
  784.     ;; If the field position is out of bounds, or there is some other
  785.     ;; kind of error, then 'Variable' is set to an empty string.
  786.     ;;
  787.     ;; For example, 
  788.     ;;
  789.     ;;    ParseField (Var1, "Position 1, Position 2", 2)
  790.     ;;
  791.     ;; would set the variable 'Var1' to be "Position 2".
  792.     ;;
  793.     ;; MidString (Variable, String, StartPos, Span)
  794.     ;; --------------------------------------------
  795.     ;; This command sets the variable 'Variable' to be a substring of the
  796.     ;; string 'String'.  The substring starts at position 'StartPos' in
  797.     ;; the source string (which is 0-based) and is 'Span' characters long.
  798.     ;; If there are not enough characters in the string at position
  799.     ;; 'StartPos' to form the substring, then as many characters as
  800.     ;; possible will be formed from that position onward.  If 'StartPos'
  801.     ;; is not within the string, a fatal error will result.
  802.     ;;
  803.     ;; OpenMessageBox (Text, Instructions)
  804.     ;; -----------------------------------
  805.     ;; This command displays the message 'Text' in a dialog box and the
  806.     ;; instruction text 'Instructions' in the instructions window.
  807.     ;; The dialog box remains until a 'CloseMessageBox' command is
  808.     ;; issued.  Other commands can occur in the setup script between the
  809.     ;; 'OpenMessageBox' and 'CloseMessageBox' commands.
  810.     ;;
  811.     ;; CloseMessageBox ()
  812.     ;; ------------------
  813.     ;; This command closes a dialog box that was opened with the
  814.     ;; 'OpenMessageBox' command.
  815.     ;;
  816.     ;; FileErrorBox (Variable, Message, File)
  817.     ;; --------------------------------------
  818.     ;; This command puts up a dialog to handle file errors.  The dialog
  819.     ;; box contains three buttons: Abort, Retry, and Ignore.  Retry is
  820.     ;; the default button.  The box contains an error message 'Message'
  821.     ;; followed by the file 'File' that is in question.
  822.     ;;
  823.     ;; If the Ignore button is pressed, the variable 'Variable' is set to
  824.     ;; the string "Ignore".  If the Retry button is pressed, 'Variable' is
  825.     ;; set to "Retry".  If the Abort button is pressed, a dialog box will
  826.     ;; ask if the user wants to end Setup.  If the user chooses Yes, then
  827.     ;; Setup will end.  If the user chooses No, then 'Variable' is set
  828.     ;; to "Retry".
  829.     ;;
  830.     ;; SetIncomplete ()
  831.     ;; ----------------
  832.     ;; This command indicates that the installation was incomplete, 
  833.     ;; causing the 'IfIncompleteGoto' command to branch to the label
  834.     ;; in its argument list.
  835.     ;;
  836.     ;; SetMustModify ()
  837.     ;; ----------------
  838.     ;; This command indicates that Setup had to modify the AUTOEXEC.BAT 
  839.     ;; file, but the user chose to do the modifications later.  This will
  840.     ;; cause the 'IfMustModifyGoto' command to branch to the label
  841.     ;; in its argument list.
  842.     ;;
  843.     ;; SetMustReboot ()
  844.     ;; ----------------
  845.     ;; This command indicates that Setup has altered the system so that
  846.     ;; the user must reboot the computer for these changes to come into
  847.     ;; effect.  This will cause the 'IfMustRebootGoto' command to branch
  848.     ;; to the label in its argument list.
  849.     ;;
  850.     ;; EnumerateWinIni (Variable, Section)
  851.     ;; -----------------------------------
  852.     ;; This command enumerates the key names associated with the section
  853.     ;; 'Section' of WIN.INI.  The key names will be separated by commas,
  854.     ;; and will be stored in the variable 'Variable'.  If 'Section' does
  855.     ;; not exist, or there is some other error, then 'Variable' will be
  856.     ;; set to the empty string.  Do not specify the brackets '[' and ']'
  857.     ;; in 'Section'.
  858.     ;;
  859.     ;; EnumerateProfileIni (Variable, File, Section)
  860.     ;; ---------------------------------------------
  861.     ;; This command is identical to 'EnumerateWinIni' except that it 
  862.     ;; operates on any initialization file specified by the name 'File'.
  863.     ;;
  864.  
  865.     ;;
  866.     ;; Subroutines
  867.     ;; -----------
  868.     ;; Subroutines can be implemented in the Setup script using the 
  869.     ;; mechanism described as follows (an example subroutine call is 
  870.     ;; provided for the installation of PostScript fonts).
  871.     ;;
  872.     ;; A subroutine may require various input and output variables.  The
  873.     ;; input variables should be set before calling the subroutine.  These
  874.     ;; variables may be altered within the subroutine; do not expect them
  875.     ;; to remain constant.  After the subroutine returns, the output 
  876.     ;; variables contain the output values.  A special variable,
  877.     ;; 'Continuation', must also be set to contain the label at which
  878.     ;; the execution resumes after the subroutine returns.  Normally,
  879.     ;; this label will be immediately after the subroutine call.  The
  880.     ;; subroutine call itself is made by a 'Goto' statement to the 
  881.     ;; subroutine's entry label.
  882.     ;;
  883.     ;;    NOTE: All variables are global!
  884.     ;;
  885.     ;; The code for a subroutine requires certain statements.  The
  886.     ;; first statement should be a 'Goto' statement that skips over
  887.     ;; the entire subroutine so that it will only be activated if it is 
  888.     ;; explicitly called.  Thus, the last statement of the subroutine
  889.     ;; should be a label to which the first 'Goto' jumps to.  The second
  890.     ;; statement in the subroutine should be the entry label of the
  891.     ;; subroutine.  The next to last statement of the subroutine should
  892.     ;; be the statement 'Goto (<Continuation>)', which allows the 
  893.     ;; subroutine to return.  For the example PostScript font installation
  894.     ;; subroutine, the first and last lines are as follows:
  895.     ;;
  896.     ;;
  897.     ;;        Goto (subInstallPSFontEnd)
  898.     ;;        subInstallPSFont:
  899.     ;;        ;
  900.     ;;        ; {body of the subroutine}
  901.     ;;        ;
  902.     ;;        Goto (<Continuation>)
  903.     ;;        subInstallPSFontEnd:
  904.     ;;
  905.     ;;
  906.  
  907.     ;;
  908.     ;; Subroutine Code: subInstallPSFont
  909.     ;; ---------------------------------
  910.     ;; This subroutine installs PostScript fonts which consist of a
  911.     ;; Windows font metric table file (.PFM) and a PostScript font file
  912.     ;; (.PFA) for each font.
  913.     ;;
  914.     ;; Subroutine entry label:
  915.     ;;    subInstallPSFont
  916.     ;; Input variables:
  917.     ;;    MetricBase - base name of the Windows font metric table file
  918.     ;;    FontBase - base name of the PostScript font file
  919.     ;;    MetricPath - full pathname of metric file
  920.     ;;    FontPath - full pathname of font file
  921.     ;; Output variables:
  922.     ;;    (none)
  923.     ;; Continuation variable:
  924.     ;;    Continuation
  925.     ;;
  926.  
  927.     ;; Skip over the subInstallPSFont subroutine.  It will be activated
  928.     ;; only if it is explicitly "called".
  929.     ;;
  930. Goto (subInstallPSFontEnd)    
  931.  
  932.     ;; Begin the subInstallPSFont subroutine.
  933.     ;;
  934. subInstallPSFont:
  935.  
  936.     ; Local constant: Printer name.  Used in dialog boxes.
  937.     ;
  938. SetVariable (ipfPrinterName, "PostScript")
  939.  
  940.     ; Local constant: Subroutine name.  Used in error dialog boxes.
  941.     ;
  942. SetVariable (ipfSubroutineName, "subInstallPSFont")
  943.  
  944.     ; Local constant: Printer driver.  Basename of the driver for which
  945.     ; we are installing fonts.
  946.     ;
  947. SetVariable (ipfDriver, "PSCRIPT")
  948.  
  949.     ; Local constant: Destination directory for the metric and
  950.     ; font files.  We will put them into the Windows system directory.
  951.     ;
  952. GetWinSystemPath (ipfSystemPath)
  953.  
  954.  
  955. OpenMessageBox (
  956.     "Setup is installing the " <ipfPrinterName> " font consisting of "
  957.     <MetricBase> " and " <FontBase> ".",
  958.     "Please wait while Setup installs " <ipfPrinterName> " fonts.")
  959.  
  960.  
  961.     ; Check if the metric and font files exist.
  962.     ;
  963. ipfCheckMetricPath:
  964. IfFileExistsGoto (<MetricPath>, ipfMetricExists)
  965.     FileErrorBox (ipfTmp , "The following file was not found:", 
  966.         <MetricPath>)
  967.     IfEqualGoto (<ipfTmp>, "Retry", ipfCheckMetricPath)
  968.     SetIncomplete ()
  969.     Goto (ipfFinished)
  970. ipfMetricExists:
  971.  
  972. ipfCheckFontPath:
  973. IfFileExistsGoto (<FontPath>, ipfFontExists)
  974.     FileErrorBox (ipfTmp , "The following file was not found:", 
  975.         <FontPath>)
  976.     IfEqualGoto (<ipfTmp>, "Retry", ipfCheckFontPath)
  977.     SetIncomplete ()
  978.     Goto (ipfFinished)
  979. ipfFontExists:
  980.  
  981.  
  982.     ; Enumerate the different printers.  This information is found in the
  983.     ; 'PrinterPorts' section of WIN.INI.
  984.     ;
  985. EnumerateWinIni (ipfPrinterPorts, "PrinterPorts")
  986. IfNotEqualGoto (<ipfPrinterPorts>, "", ipfPrinterPortsOK)
  987.     DisplayMessage (<ipfSubroutineName> ": "
  988.         "There are no printers installed.%n%n"
  989.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  990.         " and " <FontBase> " was not installed.",
  991.         "")
  992.     SetIncomplete ()
  993.     Goto (ipfFinished)
  994. ipfPrinterPortsOK:
  995.  
  996.  
  997.     ; For each printer in the 'PrinterPorts' section, find out its
  998.     ; associated printer information.  For example, ipfPrinterInfo might
  999.     ; be "PSCRIPT,LPT2:,15,45,COM2:,15,45".  If the first field in the
  1000.     ; printer information matches the desired printer driver (ipfDriver),
  1001.     ; then install the fonts for each printer listed in the printer 
  1002.     ; information.
  1003.     ;
  1004. SetVariable (ipfPortIndex, 1)
  1005. ipfPortLoop:
  1006. ParseField (ipfPrinter, <ipfPrinterPorts>, <ipfPortIndex>)
  1007.     IfEqualGoto (<ipfPrinter>, "", ipfFinished)    ; End port loop
  1008. GetFromWinIni (ipfPrinterInfo, "PrinterPorts", <ipfPrinter>, "NONE")
  1009. IfNotEqualGoto (<ipfPrinterInfo>, "NONE", ipfPrinterInfoOK)
  1010.     DisplayMessage (<ipfSubroutineName> ": "
  1011.         "There was an error reading the '" <ipfPrinter> "' entry in "
  1012.         "the 'PrinterPorts' section of WIN.INI.%n%n",
  1013.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  1014.         " and " <FontBase> " may not be completely installed.",
  1015.         "")
  1016.     SetIncomplete ()
  1017.     Goto (ipfPortInc)
  1018. ipfPrinterInfoOK:
  1019. ParseField (ipfDrv, <ipfPrinterInfo>, 1)
  1020. IfEqualGoto (<ipfDrv>, <ipfDriver>, ipfInstall)
  1021. ipfPortInc:
  1022. Add (ipfPortIndex, 1)
  1023. Goto (ipfPortLoop)
  1024.  
  1025.  
  1026. ipfInstall:
  1027.     ; Install the font for each PostScript printer
  1028.     ;
  1029. SetVariable (ipfIndex, 2)
  1030. ipfInstallLoop:
  1031. ParseField (ipfPrinterField, <ipfPrinterInfo>, <ipfIndex>)
  1032.     IfEqualGoto (<ipfPrinterField>, "", ipfPortInc)        ; End loop
  1033. MidString (ipfPort, <ipfPrinterField>, 0, 4)    ; Assume port names are 4
  1034.                         ; characters long
  1035. IfNotEqualGoto (<ipfPort>, "", ipfPortOK)
  1036.     DisplayMessage (<ipfSubroutineName> ": "
  1037.         "The WIN.INI file is defective.%n%n"
  1038.         "The " <ipfPrinterName> " font consisting of " <MetricBase> 
  1039.         " and " <FontBase> " may not be completely installed.",
  1040.         "")
  1041.     SetIncomplete ()
  1042.     Goto (ipfInstallInc)
  1043. ipfPortOK:
  1044. SetVariable (ppfContinuation, ipfInstallInc)
  1045. Goto (subPrinterPSFont)
  1046. ipfInstallInc:
  1047. Add (ipfIndex, 3)
  1048. Goto (ipfInstallLoop)
  1049.  
  1050.  
  1051. ipfFinished:
  1052. CloseMessageBox ()
  1053.     ; Return from subroutine
  1054.     ;
  1055. Goto (<Continuation>)
  1056.  
  1057.  
  1058.     ;; End of subInstallPSFont subroutine
  1059.     ;;
  1060. subInstallPSFontEnd:
  1061.  
  1062.  
  1063.     ;;
  1064.     ;; Subroutine Code: subPrinterPSFont
  1065.     ;; ---------------------------------
  1066.     ;; This subroutine installs PostScript fonts for each PostScript
  1067.     ;; printer that is installed.  Each printer is identified by its
  1068.     ;; printer port (e.g. "LPT2").  This subroutine is called by the
  1069.     ;; subInstallPSFont subroutine.
  1070.     ;;
  1071.     ;; Subroutine entry label:
  1072.     ;;    subPrinterPSFont
  1073.     ;; Input variables:
  1074.     ;;    MetricBase - base name of the Windows font metric table file
  1075.     ;;    FontBase - base name of the PostScript font file
  1076.     ;;    MetricPath - full pathname of metric file
  1077.     ;;    FontPath - full pathname of font file
  1078.     ;;    ipfPort - printer port for the particular PostScript printer
  1079.     ;;    ipfSystemPath - destination directory for the metric and font
  1080.     ;;        files
  1081.     ;;    ipfPrinter - printer type
  1082.     ;; Output variables:
  1083.     ;;    (none)
  1084.     ;; Continuation variable:
  1085.     ;;    ppfContinuation
  1086.     ;;
  1087.  
  1088.     ;; Skip over the subPrinterPSFont subroutine.  It will be activated
  1089.     ;; only if it is explicitly "called".
  1090.     ;;
  1091. Goto (subPrinterPSFontEnd)
  1092.  
  1093.     ;; Begin the subPrinterPSFont subroutine.
  1094.     ;;
  1095. subPrinterPSFont:
  1096.  
  1097.  
  1098.     ; Local constant: Prefix for the WIN.INI section of this particular
  1099.     ; printer.
  1100.     ;
  1101. SetVariable (ppfPrefix, "PostScript,")
  1102.  
  1103.  
  1104.     ; Determine the destination paths of the metric and font files.
  1105.     ;
  1106. SetVariable (ppfMetricDest, <ipfSystemPath> <MetricBase>)
  1107. SetVariable (ppfFontDest, <ipfSystemPath> <FontBase>)
  1108.  
  1109.  
  1110.     ; Determine the value to store in the WIN.INI entry
  1111.     ;
  1112. SetVariable (ppfValue, <ppfMetricDest> "," <ppfFontDest>)
  1113.  
  1114.  
  1115.     ; Determine the section name of the printer, which is the section 
  1116.     ; prefix and the printer port separated by a comma.
  1117.     ;
  1118.     ; For example, Section may be "PostScript,LPT2" for a PostScript 
  1119.     ; printer connected to printer port #2.
  1120.     ;
  1121. SetVariable (ppfSection, <ppfPrefix> <ipfPort>)
  1122.  
  1123.  
  1124.     ; Determine the number of soft fonts already installed.
  1125.     ;
  1126. GetFromWinIni (ppfSoftFonts, <ppfSection>, "softfonts", 0)
  1127.  
  1128.  
  1129.     ; Check if the metric file or the font file has already been 
  1130.     ; installed.  The softfont index (ppfIndex) and the number of 
  1131.     ; softfonts encountered (ppfCount) may not be the same since the
  1132.     ; softfonts may not be numbered consecutively.
  1133.     ;
  1134. SetVariable (ppfIndex, 1)    ; softfont index
  1135. SetVariable (ppfCount, 1)    ; number of softfonts encountered
  1136. ppfCheckLoop:
  1137. IfHigherGoto (<ppfCount>, <ppfSoftFonts>, ppfLook)
  1138. GetFromWinIni(ppfFontEntry, <ppfSection>, "softfont" <ppfIndex>, "NONE")
  1139. IfEqualGoto (<ppfFontEntry>, "NONE", ppfCheckInc)    ; non-consecutive
  1140. IfEqualGoto (<ppfFontEntry>, <ppfValue>, ppfFinished)    ; already installed
  1141. Add (ppfCount, 1)
  1142. ppfCheckInc:
  1143. Add (ppfIndex, 1)
  1144. Goto (ppfCheckLoop)
  1145.  
  1146.  
  1147. ppfLook:
  1148.     ; Look for the first empty slot to put in the new softfont entry
  1149.     ;
  1150. SetVariable (ppfLookIndex, 1)
  1151. ppfLookLoop:
  1152. IfHigherGoto (<ppfLookIndex>, <ppfSoftFonts>, ppfInstall)
  1153. GetFromWinIni(ppfFontEntry, <ppfSection>, "softfont" <ppfLookIndex>, "NONE")
  1154. IfEqualGoto (<ppfFontEntry>, "NONE", ppfInstall)
  1155. ppfLookInc:
  1156. Add (ppfLookIndex, 1)
  1157. Goto (ppfLookLoop)
  1158.  
  1159.  
  1160. ppfInstall:
  1161.     ; Update the softfont fields in the WIN.INI file.
  1162.     ; Notify Windows that the WIN.INI file has changed.
  1163.     ;
  1164. Add (ppfSoftFonts, 1)
  1165. AddToWinIni (<ppfSection>, "softfonts", <ppfSoftFonts>)
  1166. AddToWinIni (<ppfSection>, "softfont" <ppfLookIndex>, <ppfValue>)
  1167. SendWinIniChange (<ppfSection>)
  1168.  
  1169.  
  1170. ppfFinished:
  1171.     ; Copy the metric and font files.  Do this in all cases since the
  1172.     ; metric and font files may have changed, although their names
  1173.     ; have not.
  1174.     ;
  1175. CopyFile (<MetricPath>, <ppfMetricDest>, 1)
  1176. CopyFile (<FontPath>, <ppfFontDest>, 1)
  1177.  
  1178.  
  1179.     ; Notify Windows that the font files for the printer driver have
  1180.     ; changed.
  1181.     ;
  1182. SendDevModeChange (<ipfPrinter>)
  1183.  
  1184.  
  1185.     ; Return from subroutine
  1186.     ;
  1187. Goto (<ppfContinuation>)
  1188.  
  1189.     ;; End of subPrinterPSFont subroutine
  1190.     ;;
  1191. subPrinterPSFontEnd:
  1192. 
  1193.